package com.example;

import org.springframework.http.MediaType;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2016/11/20.
 */
@RestController
public class HelloController {

    @RequestMapping("/")
    public String index() {
        return "Greetings from Spring Boot!";
    }

    @RequestMapping(value="/search",produces={MediaType.APPLICATION_JSON_VALUE})
    public Person search(String personName){

        return new Person(personName, 32, "hefei");

    }

    @RequestMapping("/sayHello/")
    String index3(Model model){
        model.addAttribute("aaaa","aaaa");
        model.addAttribute("aaaa2","aaaa2");
        return "index";
    }
    @RequestMapping("/sayBye/")
    String index2(){
        return "sayBye Spring Boot";
    }
}
